﻿using System;

namespace FortuneCookie.EPiServer.SearchAndReplace
{

    /// <summary>
    /// EntityBase class
    /// </summary>
    public abstract class EntityBase
    {

        #region Members

        private Guid _id;
        private string _languageBranch;

        #endregion Members

        #region Constructor

        /// <summary>
        /// Default constructor
        /// </summary>
        protected EntityBase()
        {
            _id = Guid.NewGuid();
            _languageBranch = string.Empty;
        }

        #endregion Constructor

        #region Properties

        /// <summary>
        /// Gets or sets the Id
        /// </summary>
        public Guid Id
        {
            get
            {
                return _id;
            }
            set
            {
                if (_id == value)
                    return;

                _id = value;
                HasChanges = true;
            }
        }

        /// <summary>
        /// Gets or sets the language branch
        /// </summary>
        public string LanguageBranch
        {
            get
            {
                return _languageBranch;
            }
            set
            {
                if (_languageBranch == value)
                    return;

                _languageBranch = value;
                HasChanges = true;
            }
        }

        /// <summary>
        /// Gets or sets whether the entity exists
        /// </summary>
        public bool Existing { get; set; }

        /// <summary>
        /// Gets or sets whether the entity has changes
        /// </summary>
        public bool HasChanges { get; set; }

        #endregion Properties

    }
}
